import redis
from flask import current_app

class RedisOper():
    def __init__(self):
        host = current_app.config.get("REDIS_HOST")
        port = current_app.config.get("REDIS_PORT")
        db = current_app.config.get("REDIS_DB")
        password = current_app.config.get("REDIS_PWD")
        self.rds = redis.Redis(host=host,port=port,db=db,password=password)

    def get_v(self,data):
        return self.rds.get("data_%s"%data)
